{*
 * This file is part of the Agora distribution. 
 * Detailed copyright and licensing information can be found
 * in the gpl-3.0.txt file which should be included in the distribution.
 * 
 * @version		$Id: 3.0.14 Olympus 2010-09-28 rammstein4o $
 * @copyright  2007 - 2010 jVitals
 * @license   GPLv3 Open Source
 * @link       http://jvitals.com
 * @since      File available since initial release
 *}	

{$html->toolbar->title("##Edit User##")}
{$html->toolbar->save('save')}
{$html->toolbar->cancel()}

{$html->toolbar->divider()}

{* deleteList parameters - $msg - confirmation message, $task - task to do, $alt - message *}
{$html->toolbar->deleteList('','delete_groups','DELETE GROUPS')}

{$html->toolbar->popup('add_group','ADD GROUP','new',500,300,'user_id',$user.id)}

{$html->toolbar->divider()}

{$html->toolbar->deleteList('','delete_warnings','DELETE WARNINGS')}

{$html->toolbar->popup('add_warning','ADD WARNING','new',500,300,'user_id',$user.id)}

{script_def}
{literal}

function checkAll2( n, fldName ) {
if (!fldName) {
fldName = 'cb';
}
var f = document.adminForm;
var c = f.toggle2.checked;
var n2 = 0;
for (i=0; i < n; i++) {
cb = eval( 'f.' + fldName + '' + i );
if (cb) {
cb.checked = c;
n2++;
}
}
if (c) {
document.adminForm.boxchecked.value = n2;
} else {
document.adminForm.boxchecked.value = 0;
}
}

{/literal}
{/script_def}


<form name="adminForm" method="POST" enctype="multipart/form-data">
	{$html->form->param('option','com_agora')}
	{$html->form->param('agora_task','users')}
	{$html->form->param('task','users')}

	{$html->form->param('form[user_id]',$user.id)}

	<div class="col width-55">
		<fieldset>
			<legend>##User parameters##</legend>

			<table class="admintable">
				<tbody>
					{adminform->string caption='User name' value=$user.username}
					{adminform->text var='title' caption='Title' value=$user.title}
					{adminform->string caption='email' value=$user.email}
					{adminform->string caption='Registered' value=$user.registered|agora_date}
					{adminform->string caption='Last visit' value=$user.last_visit|agora_date}
					{adminform->string caption='LAST_KNOWN_IP' value=$user.last_known_ip}
					{adminform->string caption='Posts' value=$user.num_posts}
					{adminform->text var='location' caption='Location' value=$user.location}
					{adminform->text var='url' caption='Website' value=$user.url}
					<tr>
					<td align="right" class="key">
						<strong>##Gender##:</strong>
					</td>
					<td align="left">
						<input type="radio" name="form[gender]" value="1" {if $user.gender == '1'}checked="checked" {/if} />##Gender male##
			 <input type="radio" name="form[gender]" value="2" {if $user.gender == '2'}checked="checked" {/if} />##Gender female##
			 <input type="radio" name="form[gender]" value="0" {if $user.gender == '0'}checked="checked" {/if} />##Gender hidden##
		 </td>
					<tr>

					<tr>
					<td align="right" class="key">
						<strong>##Birthday##:</strong>
					</td>
					<td align="left">
						<select name="form[birthday-day]" style="width:50px; float:left" >
							<option value="0">--</option>
							{section name=day start=0 loop=31}
							{assign var=birth_day value=$smarty.section.day.iteration}
							<option value="{$birth_day}" {if $birthday.day eq $birth_day}selected="selected"{/if}>
			   {$birth_day}
			   </option>
							{/section}
						</select>
						<select name="form[birthday-month]" style="width:100px; float:left">
							<option value="0">--</option>
							<option value="1" {if $birthday.month eq 1}selected="selected"{/if} >##January##</option>
							<option value="2" {if $birthday.month eq 2}selected="selected"{/if}>##February##</option>
							<option value="3" {if $birthday.month eq 3}selected="selected"{/if}>##March##</option>
							<option value="4" {if $birthday.month eq 4}selected="selected"{/if}>##April##</option>
							<option value="5" {if $birthday.month eq 5}selected="selected"{/if}>##May##</option>
							<option value="6" {if $birthday.month eq 6}selected="selected"{/if}>##June##</option>
							<option value="7" {if $birthday.month eq 7}selected="selected"{/if}>##July##</option>
							<option value="8" {if $birthday.month eq 8}selected="selected"{/if}>##August##</option>
							<option value="9" {if $birthday.month eq 9}selected="selected"{/if}>##September##</option>
							<option value="10" {if $birthday.month eq 10}selected="selected"{/if}>##October##</option>
							<option value="11" {if $birthday.month eq 11}selected="selected"{/if}>##November##</option>
							<option value="12" {if $birthday.month eq 12}selected="selected"{/if}>##December##</option>
						</select>
						<select name="form[birthday-year]" style="width:80px; float:left" >
							<option value="0">--</option>
							{section name=year max=80 loop=2002 step=-1}
							{assign var=birth_year value=$smarty.section.year.index}
							<option value="{$birth_year}" {if $birthday.year eq $birth_year}selected="selected"{/if}>
			   {$birth_year}
			   </option>
							{/section}
						</select><br /><br />
						##Birthday hide age##&nbsp;&nbsp;<input type="checkbox" name="form[hide_age]" value="1"{if $user.hide_age}checked="checked"{/if} />
															</td>
					{adminform->text var='jabber' caption='Jabber' value=$user.jabber}
					{adminform->text var='icq' caption='ICQ' value=$user.icq}
					{adminform->text var='msn' caption='Msn' value=$user.msn}
					{adminform->text var='aim' caption='AOL IM' value=$user.aim}
					{adminform->text var='yahoo' caption='Yahoo' value=$user.yahoo}
					{adminform->text var='skype' caption='Skype' value=$user.skype}
					{adminform->text var='xfire' caption='XFire' value=$user.xfire}
					{adminform->textarea var='signature' caption='signature' value=$user.signature rows="4" cols="40"}
					{adminform->textarea var='aboutme' caption='aboutme' value=$user.aboutme rows="4" cols="40"}
				</tbody>
			</table>
		</fieldset>
	</div>

	<div class="col width-45">
		<fieldset>
			<legend>##Avatar##</legend>
			<table class="admintable" cellspacing="0">
				<tr>
				<td valign="top" align="right" class="key">
					##Avatar##
				</td>
				<td>
					<img src="{$user.avatar}"/>
				</td>
				<tr>
					<td valign="top" align="right" class="key">
						##Upload avatar##
					</td>
					<td>
						<input type="file" name="avatar" />
					</td>
				</tr>
				<tr>
					<td valign="top" align="right" class="key">
						##Remove avatar##
					</td>
					<td>
						{$html->jhtml('select.booleanlist',  'form[remove_avatar]', 'class="inputbox"', false)}
					</td>
				</tr>
			</table>
		</fieldset>
	</div>

	<div class="col width-45">
		<fieldset>
			<input type="hidden" name="checked" value="0"/>
			<input type="hidden" name="boxchecked" value="0"/>

			<legend>##Groups##</legend>
			<table class="adminlist">
				<thead>
					<th width="20">
						<input type="checkbox" name="toggle" value="" onclick="checkAll({$groups|@count});" />
					</th>
					<th>##group name##</th>
					<th>##role##</th>
					<th>##license id##</th>
				</thead>
				<tbody>
					{foreach name=groups from=$groups item=group}
					<tr>
						<td>{$html->jhtml('grid.id', $smarty.foreach.groups.index, $group.id)}</td>
						<td>{$html->form->treename($group)}</td>
						<td>
							<a href="{url task=users action=next_role group_id=$group.id user_id=$user.id}">
								{$group.role}
							</a>
						</td>
						<td>
							<a href="{url task=joopport page=licenses action=edit cid=$group.lic_id}">
								{if $group.lic_id == 0} Unknown license {else} {$group.lic_id} {/if}
							</a>
						</td>
					</tr>
					{/foreach}
				</tbody>
			</table>
		</fieldset>

		<fieldset>
			<legend>##Warnings##</legend>
			<table class="adminlist">
				<thead>
					<th width="20">
						<input type="checkbox" name="toggle2" value="" onclick="checkAll2({$warnings|@count},'cb_w');" />
					</th>
					<th>##Warning message##</th>
					<th>##Posted##</th>
					<th>##Expire##</th>
				</thead>
				<tbody>
					{foreach from=$warnings item=warning key=num}
					<tr>
						<td>{$html->jhtml('grid.id', "_w`$num`", $warning.user_warning_id, false, 'cid_w')}</td>
						<td>{$warning.message}</td>
						<td>{$warning.posted|agora_date}</td>
						<td>{$warning.expire|agora_date}</td>
					</tr>
					{/foreach}
				</tbody>
			</table>
		</fieldset>
	</div>
</form>
